package com.bocloud.cmp.web.controller.resource;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.bocloud.common.enums.BoCloudMethod;
import com.bocloud.common.enums.BoCloudService;
import com.bocloud.common.model.BsmResult;
import com.bocloud.registry.http.core.ServiceFactory;
import com.bocloud.registry.http.model.RemoteService;

/**
 * 平台资源
 * 
 * @author weiwei
 *
 */
@RestController
@RequestMapping("/res")
public class ResourceController {

	private static final String BASE_SERVICE = "/res";
	private static final BoCloudService SERVICE = BoCloudService.Cmp;
	@Autowired
	private ServiceFactory serviceFactory;

	/**
	 * 列表
	 * 
	 * @param params
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/vendor/store", method = { RequestMethod.POST })
	public BsmResult listVendorStore(HttpServletRequest request) {
		String url = BASE_SERVICE + "/vendor/store";
		RemoteService service = serviceFactory.safeBuild(SERVICE, url, BoCloudMethod.LIST, null, null, request);
		return service.invoke();
	}
}
